{% extends "NarbarIndex.html" %}

{% load static %}

{% block title %}配置页面{% endblock %}

{% block body %}
<div class="row">
    <div class="col-lg-8">
        <div class="row">
            <div class="col-lg-12">
                <div class="input-group input-group-lg">
                    <span class="input-group-addon" id="addon_name">{{ TextName }}</span>
                    <input type="text" class="form-control" placeholder="" aria-describedby="addon_name" id="name_text">
                </div>
            </div>
        </div>
        <div class="row" >
            {% if TextName == '策略名称' %}
                <div class="col-lg-12">
                    <textarea class="form-control" placeholder="请输入至少1个公式，以回车进行分割..." id="formula_text" rows="{{ TextLabelRows }}" cols="158"></textarea>
                </div>
            {% else %}
                <div class="col-lg-12">
                    <input class="form-control" type="text" placeholder="请输入公式..." id="formula_text" style="width:100%">
                </div>
            {% endif %}
        </div>
        <div class="row" >
            <div class="col-lg-5">
                <div id="search_window"></div>
            </div>
            <div class="col-lg-7">
                <textarea class="text_label" placeholder="{{ TextLabel }}" rows="{{ TextLabelRows }}" cols="100" readonly></textarea>
            </div>
        </div>
        <div class="row" align="left">
            <div class="col-lg-4">
                <button type="button" class="btn btn-success" id="save_btn"> 保存</button>
                <button type="button" class="btn btn-default" id="clear_btn"> 清空</button>
                <button type="button" class="btn btn-danger" id="delete_btn" style="margin-left: 50px"> 删除</button>
            </div>
            {% if TextName != '策略名称' %}
            <div class="col-lg-2">
                <buuton id="complete" class="btn btn-default">补全指标</buuton>
            </div>
            <div class="col-lg-3">
                <div class="input-group">
                    <input id="quota_recal_code" type="text" class="form-control" placeholder="默认全市场">
                    <span class="input-group-btn">
                        <buuton id="recal" class="btn btn-default">重新计算</buuton>
                    </span>
                </div><!-- /input-group -->
            </div><!-- /.col-lg-6 -->
            <div class="col-lg-3">
                <div class="input-group">
                    <input id="quota_history_code" type="text" class="form-control" placeholder="Search By code ...">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button" id="quota_history">查询!</button>
                    </span>
                </div><!-- /input-group -->
            </div><!-- /.col-lg-6 -->
            {% endif %}
        </div>
    </div>
    <div class="col-lg-4" style="padding-right:30px;">
        {% if TextName == '策略名称' %}
        <div class="row">
            <div class="row">
                <div class="col-lg-12">
                    <div class="input-group">
                        <span class="input-group-addon">默认起始资金　$</span>
                        <input id='modal_money' type="text" class="form-control" value="100000" style="text-align: right">
                        <span class="input-group-addon">.00</span>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-2">
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle code" data-toggle="dropdown"
                                id="modal_mode_code" aria-haspopup="true" aria-expanded="false" value="code">
                            代码
                        </button>
                        <ul class="dropdown-menu">
                            <li><a class="mode_code_args" value="code" href="#">代码</a></li>
                            <li><a class="mode_code_args" value="industry" href="#">行业</a></li>
                            <li><a class="mode_code_args" value="random" href="#">随机</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col-lg-10">
                    <input id="modal_text_code" type="text" class="form-control" placeholder="请输入股票代码,逗号分割">
                </div>
            </div>
            <div class="row">
                <div class="col-lg-2">
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle history" data-toggle="dropdown"
                                id="modal_mode_time" aria-haspopup="true" aria-expanded="false" value="history">
                            历史
                        </button>
                        <ul class="dropdown-menu">
                            <li><a class="mode_time_args" value="history" href="#">历史</a></li>
                            <li><a class="mode_time_args" value="random" href="#">随机</a></li>
                            <li><a class="mode_time_args" value="nd" href="#">正太</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col-lg-5">
                    <input id="modal_mode_time_args1" type="text" class="form-control" placeholder="参数１" value="2018-01-01">
                </div>
                <div class="col-lg-5">
                    <input id="modal_mode_time_args2" type="text" class="form-control" placeholder="参数２" value="2018-06-01">
                </div>
            </div>
            <div class="row">
                <div class="col-lg-5">
                    <div class="input-group">
                        <span class="input-group-addon" id="sizing-addon2">持有率</span>
                        <input style="width:100%" id="modal_buy" type="text" class="form-control" placeholder="购买通过率" value="0,100">
                        <input style="width:100%"  id="modal_sell" type="text" class="form-control" placeholder="卖出通过率" value="0,100">
                    </div>
                </div>
                <div class="col-lg-2"></div>
                <div class="col-lg-5">
                    <div class="input-group">
                        <span class="input-group-addon" id="sizing-addon3">匹配率</span>
                        <input style="width:100%" id="modal_up" type="text" class="form-control" placeholder="上限" value="100">
                        <input style="width:100%" id="modal_down" type="text" class="form-control" placeholder="下限" value="0">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-1">
                    <button id="modal_clean" type="button" class="btn btn-danger">清空</button>
                </div>
                <div class="col-lg-4"></div>
                <div class="col-lg-1">
                    <button id="modal_match" type="button" class="btn btn-warning">匹配</button>
                </div>
                <div class="col-lg-4"> </div>
                <div class="col-lg-1">
                    <button id="modal_test" type="button" class="btn btn-primary">测试</button>
                </div>
            </div>
        </div>
        {% endif %}
        <div class="row">
            <input class="form-control" type="text" placeholder="查找.." id="search_table">
        </div>
        <div class="row">
            <div id="table_item"></div>
        </div>
    </div>
</div>
<div class="row" id="match_area" style="display: none">
    <div class="col-lg-5"></div>
    <div class="col-lg-2">
        <div class="input-group">
            <input type="text" class="form-control" aria-label="..." id="match_show_code" readonly>
            <div class="input-group-btn">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                        aria-haspopup="true" aria-expanded="false" id="match_click">
                    Click!<span class="glyphicon glyphicon-hand-up"></span>
                </button>
                <ul class="dropdown-menu" id="match_code">
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="row" id="table" style="display: none;">
    <div class="panel panel-default">
        <div class="panel-heading">数据汇总</div>
        <table class="table">
            <tr>
                <td>平均盈利金额</td>
                <td id="t_apm"></td>
                <td>平均损失金额</td>
                <td id="t_alm"></td>
            </tr>
            <tr>
                <td>买入次数</td>
                <td id="t_bc"></td>
                <td>总共买入持仓</td>
                <td id="t_bp"></td>
            </tr>
            <tr>
                <td>卖出次数</td>
                <td id="t_sc"></td>
                <td>总共卖出持仓</td>
                <td id="t_sp"></td>
            </tr>
            <tr>
                <td>操作获胜概率</td>
                <td id="t_p"></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    </div>
</div>
<div class="row">
    <div id="chart" style="height:400px"></div>
</div>
<div class="row">
    <div id="chart_market" style="height:400px"></div>
</div>
<div class="row">
    <div id="chart_pass" style="height:400px"></div>
</div>
<div class="row" id="quota_area" style="display: none">
    <div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4">
            <div class="input-group">
                <input type="text" class="form-control" aria-label="..." id="quota_show_code" readonly>
                <div class="input-group-btn">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false" id="quota_click">
                        Click!<span class="glyphicon glyphicon-hand-up"></span>
                    </button>
                    <ul class="dropdown-menu" id="quota_code">
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-lg-4"></div>
    </div>
    <div class="row">
        <div id="chart_quota" style="height:400px"></div>
    </div>
</div>
{% endblock %}

{% block myjs %}
    <script type="text/javascript" src="{% static 'Configuration/config.js' %}" ></script>
{% endblock %}

